package com.lhdx.practical.bean;

import com.lhdx.practical.utils.IDGenerator;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

/**
 * 作业管理实体
 */
@Entity
@Table(name="task")
public class Task {
    @Id
    private long id;
    private long mid;

    private long sid;

    private long gradeid;

    private long groupid;
    /**
     * 类型 0个人作业 1小组作业
     */
    private int type;

    /**
     * 提交人
     */
    private long authorid;

    private String authorname;
    /**
     * 标题
     */
    private String title;
    /**
     * 附件
     */
    private String attachments;
    /**
     * 详细内容
     */
    private String detail;
    /**
     * 上传时间
     */
    private long createtime;
    /**
     * 提交顺序
     */
    private int sort;

    public Task(){}

    public Task(long id,long mid,long sid,long gradeid,int type,Person person,String title,String attachments,String detail,int sort){
        if(id == 0){
            this.id = IDGenerator.getID();
        }
        this.mid = mid;
        this.sid = sid;
        this.gradeid = gradeid;
        this.type = type;
        this.authorid = person.getId();
        this.authorname = person.getRealname();
        this.groupid = person.getGroupid();
        this.title = title;
        this.attachments = attachments;
        this.detail = detail;
        this.createtime = new Date().getTime();
        this.sort = sort;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public long getAuthorid() {
        return authorid;
    }

    public void setAuthorid(long authorid) {
        this.authorid = authorid;
    }

    public String getAuthorname() {
        return authorname;
    }

    public void setAuthorname(String authorname) {
        this.authorname = authorname;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getAttachments() {
        return attachments;
    }

    public void setAttachments(String attachments) {
        this.attachments = attachments;
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public long getCreatetime() {
        return createtime;
    }

    public void setCreatetime(long createtime) {
        this.createtime = createtime;
    }

    public long getMid() {
        return mid;
    }

    public void setMid(long mid) {
        this.mid = mid;
    }

    public long getSid() {
        return sid;
    }

    public void setSid(long sid) {
        this.sid = sid;
    }

    public int getSort() {
        return sort;
    }

    public void setSort(int sort) {
        this.sort = sort;
    }

    public long getGroupid() {
        return groupid;
    }

    public void setGroupid(long groupid) {
        this.groupid = groupid;
    }

    public long getGradeid() {
        return gradeid;
    }

    public void setGradeid(long gradeid) {
        this.gradeid = gradeid;
    }
}
